ihelpuoo.namespace("ihelpuoo.widget.language");

ihelpuoo.widget.language.LanguageListView = function(gasket)
{
	// "weboo.pattern.language.LanguageItem"
	this.view = new ihelpuoo.widget.list
						.DropListView(gasket
								,"weboo.language.list"
								,null
								,null
								,"weboo"
								,"item"
								,"getAvaLocales"
								,null
								,null
								,this.onChangeLanguage);
	this.view.parent = this;
}

ihelpuoo.widget.language.LanguageListView.prototype
=
{
	onChangeLanguage: function()
	{
		var src = ihelpuoo.event.srcElement(this);
		var v = ihelpuoo.widget.getViewByElement(src);
		v.parent.changeLanguage(src.getAttribute("value"));
	}
			
	,
	changeLanguage: function(localeName)
	{
		var url = ihelpuoo.http.server().url("weboo","setSessionLocale","locale="+localeName);
		var xml = ihelpuoo.http.GETXML(url);
		if(null!=xml && xml.documentElement && xml.documentElement.tagName=="OK")
		{
			document.location.reload();
		}	
	}
	
	// <WEBOO:INHERIT extends="ihelpuoo.widget.list.ListView">
	,draw: function(){return this.view.draw();}
	,drawNew: function(obj){return this.view.drawNew(obj);}
	,refresh: function(){return this.view.refresh();}
	,setActive: function(itemId,obj){return this.view.setActive(itemId,obj);}
	,disActiveItem: function(){return this.view.disActiveItem();}
	,deleteCheckedItems: function(){return this.view.deleteCheckedItems();}
	,getElement: function(key){return this.view.getElement(key);}
	,isNeverBeDrawn: function(){return this.view.isNeverBeDrawn();}
	,preparePattern: function(){this.view.preparePattern();}
	,display: function(){this.view.display();}
	,hide: function(){this.view.hide();}
	// </WEBOO:INHERIT>
}
